package com.example.demo.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * Created with IntelliJ IDEA.
 * User:xieChao
 * Date:2022/12/24 19:45
 */
//系统配置文件类
@Configuration
public class AppConfig  implements WebMvcConfigurer {
    @Resource
    private LoginIntercept loginIntercept;

    /**
     * 此处设置拦截信息
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginIntercept).addPathPatterns("/**").
                excludePathPatterns("/login").
                excludePathPatterns("/css/**").
                excludePathPatterns("/fonts/**").
                excludePathPatterns("/images/**").
                excludePathPatterns("/js/**").
                excludePathPatterns("/**/login.html");
    }
}
